// Copyright © 2016 Alan A. A. Donovan & Brian W. Kernighan.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/

// See page 8.

// Echo3 prints its command-line arguments.
package main

import (
	"fmt"
	"os"
	"strings"
)

//!+
func main() {
	fmt.Println(strings.Join(os.Args[:], " "))
}

//!-

//EXE3. 对比使用string.Join和for循环拼接性能
//func main()  {
//	begin1 := time.Now()
//	join1()
//	end1 := time.Now()
//	fmt.Printf("%s %s\n", begin1, end1)
//
//	begin2 := time.Now()
//	join2()
//	end2 := time.Now()
//	fmt.Printf("%s %s\n", begin2, end2)
//
//}
//
//func join1() {
//	s, sep := "", ""
//	for _, arg := range os.Args[:] {
//		s += sep + arg
//		sep = " "
//	}
//	fmt.Println(s)
//}
//
//func join2() {
//	fmt.Println(strings.Join(os.Args[:], " "))
//}
